# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=redirectpoison
pkgver=1.1
pkgrel=4
pkgdesc='A tool to poison a targeted issuer of SIP INVITE requests with 301 (i.e. Moved Permanently) redirection responses.'
url='http://www.hackingexposedvoip.com/'
groups=('blackarch' 'blackarch-voip')
license=('GPL')
arch=('x86_64' 'aarch64')
depends=('libnet' 'libpcap')
makedepends=('gcc' 'make')
source=("http://www.hackingvoip.com/tools/${pkgname}_v${pkgver}.tar.gz"
        'http://www.hackingexposedvoip.com/tools/hack_library.tar.gz'
        'hack_library.h.patch')
sha512sums=('17d3fe5c7a86235dced7c5fa464d1c4533c1f3d4004539145a15499112987b818dfee920291867d2defd6418dd0fdb9549b54fad275fddc1ee75ce889af45b0b'
            'bce70cbfd097b83d466bc7559261e2ccf10479820de8d15db65132369fa919a7805ed585a68fef16a358246a1bc8bcf02011928abbe04aaf9e4b973a47c45dce'
            'e8008237f9df722dd26a6a6a7d5a7f435e4b11d6d926ba1b0460e9617213d7a3da250d21101d7c235258d1b798324efd15ee472fda916ad2456455081f64aa4d')

prepare() {
  patch -p1 < hack_library.h.patch
}

package() {
  cd hack_library

  sed -i "s:gcc :gcc $CFLAGS :" Makefile
  make

  cd "$srcdir/${pkgname}_v$pkgver"

  sed -i "s:gcc :gcc $CFLAGS :" Makefile
  make

  install -Dm 755 $pkgname "$pkgdir/usr/bin/$pkgname"
  install -Dm 644 -t "$pkgdir/usr/share/$pkgname/" Readme.txt
}

